package com.emex.app.web;

import com.emex.app.shared.data.Cros;
import com.emex.app.shared.data.Position;
import com.emex.app.shared.ws.ShopWebService;
import com.emex.app.web.service.ShopService;
import java.util.List;
import javax.ejb.Stateless;
import javax.jws.WebService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;

/**
 *
 * @author Sergey Karavaev
 */
@WebService(serviceName = "ShopWS", portName = "ShopWSPort", targetNamespace = "http://emex.com/Shop")
@Stateless(name = "ShopWS")
public class ShopWS extends SpringBeanAutowiringSupport implements ShopWebService {

    @Autowired
    private ShopService shopService;

    @Override
    public int deletePosition(Integer id) {
        return shopService.deletePosition(id);
    }

    @Override
    public Position insertPosition(Position record) {
        return shopService.insertPosition(record);
    }

    @Override
    public Position getPositionById(Integer id) {
        return shopService.getPositionById(id);
    }

    @Override
    public Position updatePosition(Position record) {
        return shopService.updatePosition(record);
    }

    @Override
    public int deleteCros(Integer id) {
        return shopService.deleteCros(id);
    }

    @Override
    public Cros insertCros(Cros record) {
        return shopService.insertCros(record);
    }

    @Override
    public Cros getCrosById(Integer id) {
        return shopService.getCrosById(id);
    }

    @Override
    public Cros updateCros(Cros record) {
        return shopService.updateCros(record);
    }

    @Override
    public List<Position> getPositionByCode(String code) {
        return shopService.getPositionByCode(code);
    }

    @Override
    public List<Position> getCrossPositionsByPositionId(Integer id) {
        return shopService.getCrossPositionsByPositionId(id);
    }

    @Override
    public List<Position> getAllPosition() {
        return shopService.getAllPositions();
    }

    @Override
    public void deleteCrosByPositions(Position p1, Position p2) {
       shopService.deleteCrosByPositions(p1, p2);
    }

    @Override
    public List<Position> getPositionsToBuy() {
        return shopService.getPositionsToBuy();
    }
}
